/*
 * @Description: 
 * @Autor: HuiSir<273250950@qq.com>
 * @Date: 2024-08-17 14:08:50
 * @LastEditTime: 2024-09-03 01:07:22
 */
function imgLook () {
  const $imgLook = document.createElement("div")
  const $img = document.createElement("img")
  $imgLook.id = "imgLook"
  $imgLook.appendChild($img)
  $imgLook.addEventListener("click", ({ target }) => {
    // if (target.tagName !== "IMG") {
    $imgLook.remove()
    document.body.style.overflow = ""
    // }
  })

  return (selectors) => {
    const $articleCont = document.querySelector(selectors)
    $articleCont.addEventListener("click", (ev) => {
      const { target } = ev
      if (target.tagName === "IMG") {
        document.body.style.overflow = "hidden"
        $img.src = target.src
        if (!document.body.children.imgLook) {
          document.body.appendChild($imgLook)
        }
      }
    })
  }
}

export default imgLook()
